package com.baidu.controller;

import com.baidu.pojo.Result;
import com.baidu.pojo.User;
import com.baidu.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZYH
 * @version 1.0
 * @description:TODO
 * @date 2021/12/30 9:09
 */
@RequestMapping("/user")
@RestController
@CrossOrigin
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/sendCode")
    public Result sendCode(@RequestBody User user){
         return userService.sendCode(user.getPhone());
    }

    @RequestMapping("/zhuce")
    public Result zhuce(@RequestBody User user){
        return userService.zhuce(user);
    }

    @RequestMapping("/login")
    public Result login(@RequestBody User user){
        return userService.login(user);
    }

}
